package dynamicPlan;

public class guPiao {
    public int maxProfit(int[] price) {
        int temp = 0;
        for (int i = 1; i < price.length; i++) {
            if (price[i]-price[i-1]>0){
                temp+=price[i]-price[i-1];
            }
        }
        return temp;
    }

        public static void main (String[]args){
            guPiao guPiao = new guPiao();
            int[] price = {7, 1, 5, 3, 6, 4};
            System.out.println(guPiao.maxProfit(price));
        }
}
